import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

export default new VueRouter({
  routes: [
    {
      path: "/",
      component: () => import("../layout"),
      redirect: "/home",
      children: [
        {
          path: "/home",
          component: () => import("../views/home"),
          meta: {
            title: "首页",
            active: 0,
            isshow: true,
          },
        },

        {
          path: "/home/newslist",
          component: () => import("../views/news/newList"),
          meta: {
            title: "新闻列表",
            isshow: false,
          },
        },
        {
          path: "/home/newsinfo/:id",
          component: () => import("../views/news/newsInfo"),
          meta: {
            title: "新闻详情",
            isshow: false,
          },
          props: true,
        },
        {
          path: "/home/photolist",
          component: () => import("../views/photos/photoList"),
          meta: {
            title: "图片列表",
            isshow: false,
          },
        },
        {
          path: "/home/photoinfo/:id",
          component: () => import("../views/photos/photoInfo"),
          meta: {
            title: "图片详情",
            isshow: false,
          },
          props: true,
        },
        {
          path: "/home/goodslist",
          component: () => import("../views/goods/goodslist"),
          meta: {
            title: "商品列表",
            isshow: false,
          },
        },
        {
          path: "/home/goodsinfo/:id",
          component: () => import("../views/goods/goodsinfo"),
          meta: {
            title: "商品详情",
            isshow: false,
          },
          props: true,
        },
        {
          path: "/friends",
          component: () => import("../views/friends"),
          meta: {
            title: "会员",
            active: 1,
            isshow: true,
          },
        },
        {
          path: "/cart",
          component: () => import("../views/cart"),
          meta: {
            title: "购物车",
            active: 2,
            isshow: true,
          },
        },
        {
          path: "/search",
          component: () => import("../views/search"),
          meta: {
            title: "搜索",
            active: 3,
            isshow: true,
          },
        },
      ],
    },

    {
      path: "*",
      component: () => import("../views/404"),
    },
  ],
});
